local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
  _config+:: {
      namespace: 'monitoring',
      prometheus+:: {
        namespaces+: ['my-namespace', 'my-second-namespace'],
      }
    },
    prometheus+:: {
      serviceMonitorMyNamespace: {
          apiVersion: 'monitoring.coreos.com/v1',
          kind: 'ServiceMonitor',
          metadata: {
              name: 'my-servicemonitor',
              namespace: 'my-namespace',
          },
          spec: {
              jobLabel: 'app',
              endpoints: [
              {
                  port: 'http-metrics',
              },
              ],
              selector: {
                  matchLabels: {
                      'app': 'myapp',
                  },
              },
          },
        },
      },      

};

{ ['00namespace-' + name]: kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus) } +
{ ['0prometheus-operator-' + name]: kp.prometheusOperator[name] for name in std.objectFields(kp.prometheusOperator) } +
{ ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } +
{ ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
{ ['alertmanager-' + name]: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } +
{ ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } +
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) }
